home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / toolbar / toolbar.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-07  |  6.7 KB  |  227 lines

  1. VERSION 2.00
  2. Begin Form frmMain 
  3.    BackColor       =   &H00FFFFFF&
  4.    Caption         =   "Generic Form (Toolbar)"
  5.    ClientHeight    =   3645
  6.    ClientLeft      =   1185
  7.    ClientTop       =   2130
  8.    ClientWidth     =   5970
  9.    Height          =   4335
  10.    HelpContextID   =   1
  11.    Icon            =   TOOLBAR.FRX:0000
  12.    Left            =   1125
  13.    LinkTopic       =   "Form1"
  14.    ScaleHeight     =   243
  15.    ScaleMode       =   3  'Pixel
  16.    ScaleWidth      =   398
  17.    Top             =   1500
  18.    Width           =   6090
  19.    Begin PictureBox PicClip2 
  20.       Height          =   480
  21.       Left            =   0
  22.       Picture         =   TOOLBAR.FRX:0302
  23.       ScaleHeight     =   450
  24.       ScaleWidth      =   1170
  25.       TabIndex        =   4
  26.       Top             =   0
  27.       Width           =   1200
  28.    End
  29.    Begin PictureBox Panel3D2 
  30.       Align           =   2  'Align Bottom
  31.       Height          =   420
  32.       Left            =   0
  33.       ScaleHeight     =   390
  34.       ScaleWidth      =   5940
  35.       TabIndex        =   3
  36.       Top             =   3225
  37.       Width           =   5970
  38.    End
  39.    Begin Timer Timer2 
  40.       Enabled         =   0   'False
  41.       Interval        =   1000
  42.       Left            =   0
  43.       Top             =   840
  44.    End
  45.    Begin PictureBox Panel3D1 
  46.       Align           =   1  'Align Top
  47.       Height          =   405
  48.       Left            =   0
  49.       ScaleHeight     =   375
  50.       ScaleWidth      =   5940
  51.       TabIndex        =   1
  52.       Top             =   420
  53.       Visible         =   0   'False
  54.       Width           =   5970
  55.       Begin PictureBox PicClip1 
  56.          Height          =   480
  57.          Left            =   0
  58.          Picture         =   TOOLBAR.FRX:15DC
  59.          ScaleHeight     =   450
  60.          ScaleWidth      =   1170
  61.          TabIndex        =   5
  62.          Top             =   0
  63.          Width           =   1200
  64.       End
  65.       Begin PictureBox Cmd_Button 
  66.          Height          =   330
  67.          Index           =   0
  68.          Left            =   120
  69.          ScaleHeight     =   300
  70.          ScaleWidth      =   300
  71.          TabIndex        =   2
  72.          Top             =   35
  73.          Width           =   330
  74.       End
  75.    End
  76.    Begin PictureBox ToolBar 
  77.       Align           =   1  'Align Top
  78.       Height          =   420
  79.       Left            =   0
  80.       ScaleHeight     =   390
  81.       ScaleWidth      =   5940
  82.       TabIndex        =   0
  83.       Top             =   0
  84.       Width           =   5970
  85.       Begin PictureBox Toolbar_Button 
  86.          Height          =   360
  87.          Index           =   0
  88.          Left            =   180
  89.          ScaleHeight     =   330
  90.          ScaleWidth      =   330
  91.          TabIndex        =   6
  92.          Top             =   30
  93.          Width           =   360
  94.       End
  95.    End
  96.    Begin Timer Timer1 
  97.       Left            =   0
  98.       Top             =   1200
  99.    End
  100.    Begin Menu mnuFile 
  101.       Caption         =   "&File"
  102.       Begin Menu mnu_Exit 
  103.          Caption         =   "&Exit"
  104.       End
  105.    End
  106.    Begin Menu mnuEdit 
  107.       Caption         =   "&Edit"
  108.       Begin Menu mnu_Copy 
  109.          Caption         =   "&Copy"
  110.       End
  111.    End
  112.    Begin Menu mnuHelp 
  113.       Caption         =   "&Help"
  114.       Begin Menu mnu_About 
  115.          Caption         =   "&About"
  116.       End
  117.    End
  118. Option Explicit
  119. Dim I As Index
  120. Sub Form_Load ()
  121. centerform frmMain
  122.  Dim strpoint As Integer
  123.  strpoint = 1
  124.  strpoint = picclip1.Cols
  125.  Dim I As Integer, ii As Integer
  126.  For I = 0 To 14 - 1
  127.   If I > 0 Then
  128.     Load Toolbar_button(I)
  129.       Toolbar_button(I).Left = Toolbar_button(I - 1).Left + Toolbar_button(I - 1).Width - 1
  130.       Toolbar_button(I).Visible = True
  131.     Toolbar_button(I).PictureUp = picclip1.GraphicCell(I)
  132.     End If
  133.  Next
  134. For ii = 0 To 9 - 1
  135.     If ii > 0 Then
  136.     Load cmd_button(ii)
  137.       cmd_button(ii).Left = cmd_button(ii - 1).Left + cmd_button(ii - 1).Width - 1
  138.       cmd_button(ii).Visible = True
  139.       cmd_button(ii - 1).Picture = picclip1.GraphicCell(ii + 1)
  140.   End If
  141.  Next
  142.  Timer1.Interval = 1000
  143.  Timer1.Enabled = True
  144.  timer2.Enabled = True
  145. Toolbar_button(0).Visible = False
  146. End Sub
  147. Sub Form_Unload (Cancel As Integer)
  148. End Sub
  149. Sub mnu_About_Click ()
  150. Load frmAbout
  151. End Sub
  152. Sub mnu_Exit_Click ()
  153. End Sub
  154. Sub Timer1_Timer ()
  155. Dim T$, tx%
  156. T = Toolbar_button(tx).Tag
  157. Dim curhwnd As Integer      'Current hWnd
  158.       Dim p As POINTAPI
  159.       Dim sp As Integer
  160.       Static LasthWnd As Integer
  161.       If GetActiveWindow() = frmMain.hWnd Then
  162.          ' Initialize point structure:
  163.          Call GetCursorPos(p)
  164.          
  165.          curhwnd = WindowFromPoint(p.Y, p.X)
  166.       If curhwnd <> LasthWnd Then
  167.            timer2.Enabled = True
  168.             ' Store the current hWnd:
  169.             LasthWnd = curhwnd
  170.          
  171.             Timer1.Interval = 5
  172.          
  173.             Select Case curhwnd
  174.                
  175.                Case Toolbar.hWnd
  176.                   Displayhelp "Toolbar"
  177.                Case Toolbar_button(0).hWnd
  178.                   Displayhelp ""
  179.                   
  180.                Case Toolbar_button(1).hWnd
  181.                   Displayhelp "Button 1"
  182.                Case Toolbar_button(2).hWnd
  183.                   Displayhelp "Button 2"
  184.                Case Toolbar_button(3).hWnd
  185.                   Displayhelp "Button 3"
  186.                Case Toolbar_button(4).hWnd
  187.                   Displayhelp "Button 4"
  188.                Case Toolbar_button(5).hWnd
  189.                   Displayhelp "Button 5"
  190.                Case Toolbar_button(6).hWnd
  191.                   Displayhelp "Button 6"
  192.                Case Toolbar_button(7).hWnd
  193.                   Displayhelp "Button 7"
  194.                Case Toolbar_button(8).hWnd
  195.                   Displayhelp "Button 8"
  196.                Case Toolbar_button(9).hWnd
  197.                   Displayhelp "Button 9"
  198.                Case Toolbar_button(10).hWnd
  199.                   Displayhelp "Button 10"
  200.                Case Toolbar_button(11).hWnd
  201.                   Displayhelp "Button 11"
  202.                Case Toolbar_button(12).hWnd
  203.                   Displayhelp "Button 12"
  204.                Case Toolbar_button(13).hWnd
  205.                   Displayhelp "Button 13"
  206.                
  207.                Case frmHelp.hWnd
  208.                 ' If it moves onto the help window, hide it:
  209.                  'frmHelp.Hide
  210.                Case Else
  211.                   Displayhelp T$
  212.                   Timer1.Interval = 1000
  213.             
  214.             End Select
  215.             
  216.          End If
  217.       End If
  218. End Sub
  219. Sub Toolbar_Button_Click (Index As Integer, Value As Integer)
  220. Select Case Value
  221. Case True
  222. Toolbar_button(Index).Value = False
  223. Case False
  224. Value = False
  225. End Select
  226. End Sub
  227.